package com.example.certificate.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
@ApiModel(value = "新增用户")
public class InsOrgUserDto {

    @ApiModelProperty(value = "姓名")
    @NotBlank(message = "姓名不能为空",groups = {insUser.class})
    private String name;

    @ApiModelProperty(value = "邮箱号")
    @NotBlank(message = "邮箱号不能为空",groups = {insUser.class})
    @Email(message = "邮箱号不正确",groups = {insUser.class})
    private String email;

    @ApiModelProperty(value = "用户性别，1、男，0、女")
    @NotNull(message = "用户性别不能为空",groups = {insUser.class})
    private Integer gender;

    @ApiModelProperty(value = "手机号")
    @NotBlank(message = "手机号不能为空",groups = {insUser.class})
    @NotNull(message = "手机号不能为空",groups = {insUser.class})
    @Length(min = 11, max = 11, message = "手机号只能为11位")
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误",groups = {insUser.class})
    private String phone;

    @ApiModelProperty(value = "用户名")
    @NotBlank(message = "用户名不能空",groups = {insUser.class})
    @Length(min = 6, max = 15, message = "用户名长度在6—15位之间",groups = {insUser.class})
    private String userName;

    @ApiModelProperty(value = "密码")
    @Pattern(regexp = "^(?=.*[0-9])(?=.*[a-zA-Z])(.{8,16})$",
             message = "8-16位，必须同时包含小写字母、大写字母、数字和特殊字符",groups = {insUser.class})
    private String password;

   /* @ApiModelProperty(value = "用户组织角色信息")
    @NotNull(message = "用户角色不能为空",groups = insUser.class)
    private List<RelationParamsVo> relationRoles;*/

    @ApiModelProperty(value = "用户头像")
    @NotBlank(message = "用户头像不能为空",groups = {insUser.class})
    private String image;

    public interface insUser{}
}
